//流程图节点标记
$(function () {
  stepBar.init("stepBar-1", {
    step: 3,
    change: false,
    animation: true
  });
});
//投标流程节点Icon效果
$(function () {
  var cltxt = $('.tp-l ').parent().parent().children('a').attr('class');
  if (cltxt == 'ui-stepSequence judge-stepSequence-pre') {
    $('.tp-l ').addClass('tep-tl');
  } else {
    return false;
  }
});
//文件下载权限申请
$(".download-icon").on('click', function () {
  //询问框
  layer.confirm('权限不足，是否申请更高权限？', {
    title: '提示信息',
    btn: ['申请', '取消'] //按钮
  }, function () {
    layer.msg('申请成功', {
      icon: 1
    });
  });
});

// 投标文件
var tenderColumns = [{
  id: 'filenav',
  title: '文件类目',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filetype',
  title: '文件类别',
  width: 120,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'fileName',
  title: '文件名',
  // width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filemsg',
  title: '文件说明',
  type: 'string',
  columnClass: 'text-left',
  hideType: 'lg|md|sm|xs'
}, {
  id: 'filelv',
  title: '文件版本',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'uname',
  title: '上传人员',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'utime',
  title: '上传时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="update(' + record.id + ');"><i class="icon-cloud-upload"></i>  更新</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  下载</button>';
    return content;
  }
}];
var tenderOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '投标文件列表',
  datas: [{
    id: 1,
    filenav: '市场体系',
    filetype: '投标技术文档',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, {
    id: 2,
    filenav: '市场体系',
    filetype: '投标商务文档',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, {
    id: 3,
    filenav: '市场体系',
    filetype: '投标交付方案',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, {
    id: 4,
    filenav: '市场体系',
    filetype: '投标法务文档',
    fileName: '',
    filemsg: '',
    filelv: '',
    uname: '',
    utime: ''
  }, ],
  columns: tenderColumns,
  gridContainer: 'tenderContainer',
  toolbarContainer: 'tenderToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var tenderGrid = $.fn.dlshouwen.grid.init(tenderOption);
$(function () {
  tenderGrid.load();
});

//文件上传统一字段
function showfile() {
  $(".hidefile").show();
};

function hidefile() {
  $(".hidefile").hide();
};
//文件下载权限事件
function down(id) {
  //询问框
  layer.confirm('权限不足，是否申请更高权限？', {
    title: '提示信息',
    btn: ['申请', '取消'] //按钮
  }, function () {
    layer.msg('申请成功', {
      icon: 1
    });
  });
};
//文件更新事件
function update(id) {
  window.location.href = "../../proinfo/edit/edit-document-1.html" + '?id=' + id;
};
// 合同文件
var pactColumns = [{
  id: 'filenav',
  title: '文件类目',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filetype',
  title: '文件类别',
  width: 120,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'fileName',
  title: '文件名',
  // width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filemsg',
  title: '文件说明',
  type: 'string',
  columnClass: 'text-left',
  hideType: 'lg|md|sm|xs'
}, {
  id: 'filelv',
  title: '文件版本',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'uname',
  title: '上传人员',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'utime',
  title: '上传时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="upfile(' + record.id + ');"><i class="icon-cloud-upload"></i>  更新</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  下载</button>';
    return content;
  }
}];
var pactOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '合同文件列表',
  datas: [{
    id: 1,
    filenav: '市场体系',
    filetype: '合同文本',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, ],
  columns: pactColumns,
  gridContainer: 'pactContainer',
  toolbarContainer: 'pactToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var pactGrid = $.fn.dlshouwen.grid.init(pactOption);
$(function () {
  pactGrid.load();
});

function upfile(id) {
  window.location.href = "../../proinfo/edit/edit-document-2.html" + '?id=' + id;
};

// 回款信息
var recbleColumns = [{
  id: 'recNo',
  title: '单据号',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'recName',
  title: '经办人',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'recPrc',
  title: '回款金额',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'recTime',
  title: '回款日期',
  type: 'string',
  width: 100,
  columnClass: 'text-left',
}, {
  id: 'recText',
  title: '回款说明',
  type: 'string',
  columnClass: 'text-center',
},{
  id: 'utime',
  title: '上传时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 170,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick=""><i class="icon-edit"></i>  编辑</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  附件下载</button>';
    return content;
  }
}];
var recbleOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '回款信息列表',
  datas: [{
    id: 1,
    recNo: 'NJ20180902183024',
    recName: '张三测试',
    recPrc: '￥22000000.00元',
    recTime: '2017-08-01',
    recText: '回款说明测试数据',
    utime: '2018-03-01',
  }, ],
  columns: recbleColumns,
  gridContainer: 'recbleContainer',
  toolbarContainer: 'recbleToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var recbleGrid = $.fn.dlshouwen.grid.init(recbleOption);
$(function () {
  recbleGrid.load();
});

// 初验报告
var recaColumns = [{
  id: 'filenav',
  title: '文件类目',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filetype',
  title: '文件类别',
  width: 120,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'fileName',
  title: '文件名',
  // width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filemsg',
  title: '文件说明',
  type: 'string',
  columnClass: 'text-left',
  hideType: 'lg|md|sm|xs'
}, {
  id: 'filelv',
  title: '文件版本',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'uname',
  title: '上传人员',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'utime',
  title: '上传时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="reca(' + record.id + ');"><i class="icon-cloud-upload"></i>  更新</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  下载</button>';
    return content;
  }
}];
var recaOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '合同文件列表',
  datas: [{
    id: 1,
    filenav: '售后',
    filetype: '验收报告',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, ],
  columns: recaColumns,
  gridContainer: 'recaContainer',
  toolbarContainer: 'recaToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var recaGrid = $.fn.dlshouwen.grid.init(recaOption);
$(function () {
  recaGrid.load();
});
//文件更新事件
function reca(id) {
  window.location.href = "../../proinfo/edit/edit-reca.html" + '?id=' + id;
};
// 终验报告
var recbColumns = [{
  id: 'filenav',
  title: '文件类目',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filetype',
  title: '文件类别',
  width: 120,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'fileName',
  title: '文件名',
  // width: 150,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filemsg',
  title: '文件说明',
  type: 'string',
  columnClass: 'text-left',
  hideType: 'lg|md|sm|xs'
}, {
  id: 'filelv',
  title: '文件版本',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'uname',
  title: '上传人员',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'utime',
  title: '上传时间',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-success" onclick="recb(' + record.id + ');"><i class="icon-cloud-upload"></i>  更新</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  下载</button>';
    return content;
  }
}];
var recbOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '合同文件列表',
  datas: [{
    id: 1,
    filenav: '售后',
    filetype: '验收报告',
    fileName: '文件名测试数据',
    filemsg: '文件说明测试数据',
    filelv: 'V 1.0',
    uname: '张三',
    utime: '2018-08-01'
  }, ],
  columns: recbColumns,
  gridContainer: 'recbContainer',
  toolbarContainer: 'recbToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var recbGrid = $.fn.dlshouwen.grid.init(recbOption);
$(function () {
  recbGrid.load();
});
//文件更新事件
function recb(id) {
  window.location.href = "../../proinfo/edit/edit-recb.html" + '?id=' + id;
};

// 项目费用报销记录
var costColumns = [{
  id: 'filenav',
  title: '项目阶段',
  width: 80,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filetype',
  title: '报销单号',
  width: 130,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filelv',
  title: '报销总金额',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'fileName',
  title: '申请人',
  width: 70,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'filemsg',
  title: '审批日期',
  type: 'string',
  width: 100,
  columnClass: 'text-left',
}, {
  id: 'uname',
  title: '其他说明',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 50,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-primary" onclick="cost(' + record.id + ');"><i class="icon-eye-open"></i>  查看</button>';
    return content;
  }
}];
var costOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '项目费用报销记录',
  datas: [{
    id: 1,
    filenav: '线索阶段',
    filetype: 'NJ201809091223',
    fileName: '张三测试',
    filemsg: '2010-08-02',
    filelv: '￥99999.00元',
    uname: '其他说明测试数据',
  },],
  columns: costColumns,
  gridContainer: 'costContainer',
  toolbarContainer: 'costToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var costGrid = $.fn.dlshouwen.grid.init(costOption);
$(function () {
  costGrid.load();
});

// 报销记录明细
function cost(id){
  window.location.href = "../../proinfo/edit/edit-cost.html" + '?id=' + id;
}
